#pragma once

#define CW_SCREEN 0
#define CW_WORKAREA	1
typedef BOOL (WINAPI *SETLAYEREDWINDOWATTRIBUTES)(HWND,COLORREF,BYTE,DWORD); 

class CBaseWindow
{
public:
	CBaseWindow(void);
	virtual ~CBaseWindow(void);

public:
	HWND m_hWnd;

	virtual BOOL CreateEx(
		DWORD dwExStyle,
		LPCTSTR lpszClass, LPCTSTR lpszName, DWORD dwStyle,
		int nX, int nY, int cx, int cy,
		HWND hParent,
		HMENU hMenu,
		HINSTANCE hInst
	);
	virtual void GetWndClassEx(WNDCLASSEX& wc);
	virtual WPARAM MsgLoop();

	BOOL CenterWindow(DWORD dwFlags=CW_SCREEN);
	void Show(BOOL show);
	void Toggle();

	virtual int OnCommand(HWND hwnd, WORD wID, WORD wNotifyCode);
	virtual int OnCommandExt(HWND hWnd, WORD wID, WORD wNotifyCode);
	virtual int OnNcCreate(LPCREATESTRUCT lpcs);
	virtual int OnCreate(LPCREATESTRUCT lpcs);
	virtual void OnClose();

	Bitmap* LoadPng(unsigned short pName, LPCTSTR pType=_T("PNG"));
	
	int Msgbox(LPCTSTR pMsg, LPCTSTR pTitle=_T(""), UINT uType=MB_OK);
	SETLAYEREDWINDOWATTRIBUTES SetLayeredWindowAttributes;
	void SetTransparent(int rate);

protected:
	HINSTANCE m_hInst;
	BOOL hidden;
	static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	virtual LRESULT WndProcExt(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	virtual LRESULT WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);

private:
	BOOL RegisterClass(LPCTSTR lpszClass, HINSTANCE hInst);
};

